package com.example.helloworld;

import android.os.Bundle;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.*;
import android.content.Intent;

public class MainActivity extends Activity {
	
	private Button myButton = null;
	private EditText myEditText1 = null;
	private EditText myEditText2 = null;
	private TextView myTextView = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myButton = (Button)findViewById(R.id.myButton);
        myButton.setText(R.string.calc);
        myTextView = (TextView)findViewById(R.id.myTextView);
        myTextView.setText(R.string.TextView);
        myEditText1 = (EditText)findViewById(R.id.myEditText1);
        myEditText2 = (EditText)findViewById(R.id.myEditText2);
  
        myButton.setOnClickListener(new View.OnClickListener(){
        	@Override
			public void onClick(View v) {
        		String str1 = myEditText1.getText().toString();
        		String str2 = myEditText2.getText().toString();
        		Intent intent = new Intent();
        		intent.putExtra("one", str1);
        		intent.putExtra("two", str2);
        		intent.setClass(MainActivity.this, Other.class);
        		MainActivity.this.startActivity(intent);
			}
        }
        );
        
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0,1,1,R.string.exit);
		menu.add(0,2,2,R.string.about);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if(item.getItemId() == 1)
		{
			finish();
		}
		return super.onOptionsItemSelected(item);
	}
	
	
    
}
